package com.daxia.ogmall.common;

import org.apache.log4j.Logger;

public enum Logs {
	Service(1, "log.service"), 
	Page(1, "log.page"),
	Pay(2, "log.pay"),
	DAO(3, "log.dao"),
	COMMON(4, "common");
	

	private int value;
	private String remark;
	private Logger logger;

	private Logs(int value, String remark) {
		this.value = value;
		this.remark = remark;
		this.logger = Logger.getLogger(remark);
	}

	public int getValue() {
		return value;
	}

	public String getRemark() {
		return remark;
	}

	public void debug(Object log) {
		if (logger.isDebugEnabled()) {
			logger.debug(log);
		}
	}
	
	public static Logs getByValue(int value) {
		for (Logs o : Logs.values()) {
			if (o.getValue() == value) {
				return o;
			}
		}
		return null;
	}
}
